Visual Basic (Declaration) | |
---|---|
Public Function New( _ ByVal capacity As Integer, _ ByVal ordering As LurchTableOrder, _ ByVal comparer As IEqualityComparer(Of TKey) _ ) |
C# | |
---|---|
public LurchTable<TKey,TValue>( int capacity, LurchTableOrder ordering, IEqualityComparer<TKey> comparer ) |
Parameters
- capacity
- ordering
- comparer
Library/Library.Test/TestLurchTable.cs
C# | Copy Code |
---|---|
var cmp = new IntComparer(); const int limit = 5; Assert.AreEqual(LurchTableOrder.None, new LurchTable<int, int>(1).Ordering); Assert.AreEqual(LurchTableOrder.Insertion, new LurchTable<int, int>(1, LurchTableOrder.Insertion).Ordering); Assert.IsTrue(ReferenceEquals(cmp, new LurchTable<int, int>(1, LurchTableOrder.Insertion, cmp).Comparer)); Assert.AreEqual(LurchTableOrder.Modified, new LurchTable<int, int>(LurchTableOrder.Modified, limit).Ordering); Assert.AreEqual(limit, new LurchTable<int, int>(LurchTableOrder.Modified, limit).Limit); Assert.AreEqual(LurchTableOrder.Access, new LurchTable<int, int>(LurchTableOrder.Access, limit, cmp).Ordering); Assert.AreEqual(limit, new LurchTable<int, int>(LurchTableOrder.Access, limit, cmp).Limit); Assert.IsTrue(ReferenceEquals(cmp, new LurchTable<int, int>(LurchTableOrder.Access, limit, cmp).Comparer)); Assert.AreEqual(LurchTableOrder.Access, new LurchTable<int, int>(LurchTableOrder.Access, limit, 1, 1, 1, cmp).Ordering); Assert.AreEqual(limit, new LurchTable<int, int>(LurchTableOrder.Access, limit, 1, 1, 1, cmp).Limit); Assert.IsTrue(ReferenceEquals(cmp, new LurchTable<int, int>(LurchTableOrder.Access, limit, 1, 1, 1, cmp).Comparer)); |
VB.NET | Copy Code |
---|---|
Dim cmp As var = New IntComparer() Const limit As Integer = 5 Assert.AreEqual(LurchTableOrder.None, New LurchTable(Of Integer, Integer)(1).Ordering) Assert.AreEqual(LurchTableOrder.Insertion, New LurchTable(Of Integer, Integer)(1, LurchTableOrder.Insertion).Ordering) Assert.IsTrue(ReferenceEquals(cmp, New LurchTable(Of Integer, Integer)(1, LurchTableOrder.Insertion, cmp).Comparer)) Assert.AreEqual(LurchTableOrder.Modified, New LurchTable(Of Integer, Integer)(LurchTableOrder.Modified, limit).Ordering) Assert.AreEqual(limit, New LurchTable(Of Integer, Integer)(LurchTableOrder.Modified, limit).Limit) Assert.AreEqual(LurchTableOrder.Access, New LurchTable(Of Integer, Integer)(LurchTableOrder.Access, limit, cmp).Ordering) Assert.AreEqual(limit, New LurchTable(Of Integer, Integer)(LurchTableOrder.Access, limit, cmp).Limit) Assert.IsTrue(ReferenceEquals(cmp, New LurchTable(Of Integer, Integer)(LurchTableOrder.Access, limit, cmp).Comparer)) Assert.AreEqual(LurchTableOrder.Access, New LurchTable(Of Integer, Integer)(LurchTableOrder.Access, limit, 1, 1, 1, cmp).Ordering) Assert.AreEqual(limit, New LurchTable(Of Integer, Integer)(LurchTableOrder.Access, limit, 1, 1, 1, cmp).Limit) Assert.IsTrue(ReferenceEquals(cmp, New LurchTable(Of Integer, Integer)(LurchTableOrder.Access, limit, 1, 1, 1, cmp).Comparer)) |
Target Platforms: Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7